package com.acxy.ueditor;

import com.acxy.ants.common.kit.PathKit;
import com.acxy.ants.resful.annotation.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * ueditor上传统一接口
 * 修改了源码2处地方问题:1/本地文件在线预览不了
 * 2/上传图片成功后显示不了图片因没有加载项目名称
 *
 * @author MrShun
 * @version 1.0
 * @Date 2017-06-22
 */
@Controller("ue")
public class UEUploadAction {

    /**
     * ue上传文件通用路径
     *
     * @param request
     * @param response
     * @throws IOException
     */
    public void upload(HttpServletRequest request, HttpServletResponse response) throws IOException {
        String rootPath = request.getSession().getServletContext().getRealPath("/");
        String configPath = PathKit.getClassPath() + "config.json";
        PrintWriter out = response.getWriter();
        out.write(new ActionEnter(request, rootPath, configPath).exec());
    }
}
